﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tester.DL645.Responses
{
    /// <summary>
    /// 电流 响应
    /// </summary>
    public class PhaseCurrentResponse:AbstractReponse
    {
         public   Core.Phase Phase { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public decimal Value { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string Description { get; set; }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="buffer"></param>
        public PhaseCurrentResponse(byte[] buffer ,Core.Phase phase):base(buffer)
        {
            this.Phase = phase;
            this.Phase = phase;
       

            this.Value = int.Parse(string.Join("", buffer.Skip(14)
                .Take(3).Reverse()
               .Select(item => (item - 0x33).ToString("X2")))) * 0.001m;

            this.Description = string.Format("{0}：{1}", this.Phase.ToString(), this.Value.ToString());
        }
    }
}
